#pragma once

#include <physics/Joint.h>
#include <physics/Registrator.h>
#include <physics/Node.h>

struct b2RevoluteJointDef;

namespace physics
{

class RevoluteJoint: public Joint
{
	PHYSICS_JOINT_REGISTER(RevoluteJoint)

protected:
	virtual bool on_node(xml::Provider *prov, const std::string &name);

	b2RevoluteJointDef* GetJointDef() { return (b2RevoluteJointDef*) jointDef.get(); }

public:
	RevoluteJoint(World *world);
	RevoluteJoint(World * world, Node * nodeA, Node  * nodeB, const Vector2 & anchorA, const Vector2 & anchorB, bool collideConnected);
	virtual ~RevoluteJoint();
	
	void SetLimits(bool enabled, float lowerAngle, float upperAngle);
	bool IsLimitsEnabled() const;
	float GetLowerAngle() const;
	float GetUpperAngle() const;
};

}